<!DOCTYPE html>
<html lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  
  <title itemprop="name">编码5五分钟，命名两小时？不可能的！ | 耿超Blog</title>
  
    <link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/28.jpg">
  
  <meta http-equiv="x-dns-prefetch-control" content="on">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+SerifMerriweather|Merriweather+Sans|Source+Code+Pro|Ubuntu:400,700|Noto+Serif+SC" media="all">
  <link rel="dns-prefetch" href="//cdn.jsdelivr.net">
  <link rel="stylesheet" id="saukra_css-css" href="/css/style.css" type="text/css" media="all">


  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.6/dist/jquery.fancybox.min.css">

  <link rel="stylesheet" href="/css/lib.min.css" media="all">
  <link rel="stylesheet" href="/css/font.css" media="all">
  <link rel="stylesheet" href="/css/insight.css" media="all">
  <link rel="stylesheet" href="/css/jquery.fancybox.min.css" media="all">
  <link rel="stylesheet" href="/css/zoom.css" media="all">
  <link rel="stylesheet" type="text/css" href="/css/sharejs.css">
<!--   <link rel="stylesheet" id="saukra_css-css" href="https://2heng.xin/wp-content/cache/autoptimize/css/autoptimize_ad42a61f4c7d4bdd9f91afcff6b5dda5.css
" type="text/css" media="all"> -->
  <script>
  /*Initial Variables*/
  var mashiro_option = new Object();
  var mashiro_global = new Object();
  mashiro_option.NProgressON = true;
  /* 
   * 邮箱信息之类的东西可以填在这里，这些js变量基本都作用于sakura-app.js
   * 这样的设置仅是为了方便在基于PHP开发的主题中设置js变量，既然移植到了Node上，我想或许可以精简这一逻辑吧
   */
  mashiro_option.email_domain = "";
  mashiro_option.email_name = "";
  mashiro_option.cookie_version_control = "";
  mashiro_option.qzone_autocomplete = false;
  mashiro_option.site_name = "BigBoss耿超";
  mashiro_option.author_name = "耿超";
  mashiro_option.site_url = "https://www.gengchao.vip";
  mashiro_option.v_appId = "aeY1WNVHlNPxnev04uP4OGiN-gzGzoHsz";
  mashiro_option.v_appKey = "eC65yOIwHWdj1SI18Dc25mV2";
  mashiro_option.mathjax = "0";
  mashiro_option.qq_api_url = "https://api.mashiro.top/qqinfo/"; 
  mashiro_option.qq_avatar_api_url = "https://api.mashiro.top/qqinfo/";

  // mashiro_option.jsdelivr_css_src = "https://cdn.jsdelivr.net/gh/moezx/cdn@3.4.5/css/lib.min.css";
  // mashiro_option.float_player_on = true;

  /*End of Initial Variables*/
  </script>
  <script type="text/javascript">
  var bg = "https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/3.jpg,https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/9.jpg,https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/10.jpg".split(",");
  var bgindex = Math.floor(Math.random()*bg.length);
  if (!!window.ActiveXObject || "ActiveXObject" in window) { //is IE?
    alert('朋友，IE浏览器未适配哦~');
  }
  </script>
  <style type="text/css">
  .hljs-ln{border-collapse:collapse}.hljs-ln td{padding:0}.hljs-ln-n:before{content:attr(data-line-number)}
  </style>
  <style type="text/css">.site-top .lower nav{display:block !important;}.author-profile i,.post-like a,.post-share .show-share,.sub-text,.we-info a,span.sitename,.post-more i:hover,#pagination a:hover,.post-content a:hover,.float-content i:hover{color:#FE9600}.feature i,.download,.navigator i:hover,.links ul li:before,.ar-time i,span.ar-circle,.object,.comment .comment-reply-link,.siren-checkbox-radio:checked + .siren-checkbox-radioInput:after{background:#FE9600}::-webkit-scrollbar-thumb{background:#FE9600}.download,.navigator i:hover,.link-title,.links ul li:hover,#pagination a:hover,.comment-respond input[type='submit']:hover{border-color:#FE9600}.entry-content a:hover,.site-info a:hover,.comment h4 a,#comments-navi a.prev,#comments-navi a.next,.comment h4 a:hover,.site-top ul li a:hover,.entry-title a:hover,#archives-temp h3,span.page-numbers.current,.sorry li a:hover,.site-title a:hover,i.iconfont.js-toggle-search.iconsearch:hover,.comment-respond input[type='submit']:hover{color:#FE9600}.comments .comments-main{display:block !important;}.comments .comments-hidden{display:none !important;}background-position:center center;background-attachment:inherit;}
  </style>
</head>
</html>
<body class="page-template page-template-user page-template-page-analytics page-template-userpage-analytics-php page page-id-1297 chinese-font serif isWebKit">
  <div class="scrollbar" id="bar">
  </div>
  <a href="#" class="cd-top faa-float animated"></a>
  <section id="main-container">
    <div class="headertop filter-dim">
  <div id="banner_wave_1"></div>
  <div id="banner_wave_2"></div>
  <figure id="centerbg" class="centerbg">
    <div class="focusinfo no-select">
     <!-- <div class="header-tou">
        <a href="https://www.gengchao.vip">
          <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/21.jpg">
        </a>
      </div>-->
      <div class="header-info">
        <p>虽千万人，吾往矣！！</p>
        <div class="top-social_v2">
          <li id="bg-pre">
            <img class="flipx" src="https://cdn.jsdelivr.net/gh/honjun/cdn@1.6/img/other/next-b.svg">
          </li>
          
            
              
                <li>
                  <a href="http://github.com/geng-chao" target="_blank" class="social-github" title="github">
                    <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/social/github.png">
                  </a>
                </li>
              
            
              
                <li>
                  <a href="https://y.qq.com/portal/profile.html#stat=y_new.top.user_pic" target="_blank" class="social-github" title="wangyiyun">
                    <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/social/wangyiyun.png">
                  </a>
                </li>
              
            
              
                <li>
                  <a href="http://weibo.com/mashirozx?is_all=1" target="_blank" class="social-github" title="email">
                    <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/social/email.svg">
                  </a>
                </li>
              
            
              
                <li class="wechat">
                  <a href="/#">
                    <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/social/wechat.png">
                  </a>
                  <div class="wechatInner">
                    <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/31.jpg">
                  </div>
                </li>
              
            
          
          <li id="bg-next">
            <img src="https://cdn.jsdelivr.net/gh/honjun/cdn@1.6/img/other/next-b.svg">
          </li>
        </div>
      </div>
    </div>
  </figure>
  <div id="video-container" style="">
    <video style="object-fit: fill" id="bgvideo" class="video" video-name="" src="" width="auto" preload="auto">
    </video>
    <div id="video-btn" class="loadvideo videolive">
    </div>
    <div id="video-add">
    </div>
    <div class="video-stu">
    </div>
  </div>
  <div class="headertop-down faa-float animated" onclick="headertop_down()">
    <span>
      <i class="fa fa-chevron-down" aria-hidden="true">
      </i>
    </span>
  </div>
</div>
    <div id="page" class="site wrapper">
      <header class="site-header no-select gizle sabit" role="banner">
  <div class="site-top">
    <div class="site-branding">
      <span class="site-title">
        <span class="logolink moe-mashiro">
          <a href="/">
            <span class="sakurasono">BigBoss</span>
            <span class="shironeko">耿超</span>
          </a>
        </span>
      </span>
    </div>
    <div class="searchbox search-form-submit">
      <i class="iconfont js-toggle-search iconsearch icon-search">
      </i>
    </div>
    <div id="show-nav" class="showNav mobile-fit">
      <div class="line line1">
      </div>
      <div class="line line2">
      </div>
      <div class="line line3">
      </div>
    </div>
    <div class="lower-cantiner">
      <div class="lower">
        <nav class="mobile-fit-control hide">
          <ul id="menu-new" class="menu">
            
              <li>
                <a href="/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-fort-awesome faa-shake" aria-hidden="true"></i>
                    首页
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/archives">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-archive faa-shake" aria-hidden="true"></i>
                    归档
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/categories/技术/">
                          <i class="fa fa-code" aria-hidden="true"></i>
                          技术
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/生活/">
                          <i class="fa fa-file-text-o" aria-hidden="true"></i>
                          生活
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/资源/">
                          <i class="fa fa-cloud-download" aria-hidden="true"></i>
                          资源
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/java/">
                          <i class="fa fa-commenting-o" aria-hidden="true"></i>
                          java
                        </a>
                      </li>
                    
                      <li>
                        <a href="/categories/转载/">
                          <i class="fa fa-book" aria-hidden="true"></i>
                          转载
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li>
                <a href="javascript:;">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-list-ul faa-vertical" aria-hidden="true"></i>
                    清单
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/tags/悦读/">
                          <i class="fa fa-th-list faa-bounce" aria-hidden="true"></i>
                          书单
                        </a>
                      </li>
                    
                      <li>
                        <a href="/bangumi/">
                          <i class="fa fa-film faa-vertical" aria-hidden="true"></i>
                          番组
                        </a>
                      </li>
                    
                      <li>
                        <a href="/music/">
                          <i class="fa fa-headphones" aria-hidden="true"></i>
                          歌单
                        </a>
                      </li>
                    
                      <li>
                        <a href="/tags/图集/">
                          <i class="fa fa-photo" aria-hidden="true"></i>
                          图集
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li>
                <a href="/comment/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-pencil-square-o faa-tada" aria-hidden="true"></i>
                    留言板
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/links/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-link faa-shake" aria-hidden="true"></i>
                    友人帐
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/donate/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-heart faa-pulse" aria-hidden="true"></i>
                    赞赏
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-leaf faa-wrench" aria-hidden="true"></i>
                    关于
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/about/">
                          <i class="fa fa-meetup" aria-hidden="true"></i>
                          我？
                        </a>
                      </li>
                    
                      <li>
                        <a href="/theme-sakura/">
                          <i class="fa iconfont icon-sakura" aria-hidden="true"></i>
                          主题
                        </a>
                      </li>
                    
                      <li>
                        <a href="/lab/">
                          <i class="fa fa-cogs" aria-hidden="true"></i>
                          Lab
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li>
                <a href="/client/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-android faa-vertical" aria-hidden="true"></i>
                    客户端
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/atom.xml">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-rss faa-pulse" aria-hidden="true"></i>
                    RSS
                  </span>
                </a>
                
              </li>
            
          </ul>
        </nav>
      </div>
    </div>
  </div>
</header>

      <link rel="stylesheet" type="text/css" href="/css/sharejs.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css">
<div class="pattern-center-blank"></div>

  <div class="pattern-center single-center">
    <!-- 有配图默认渲染第一张 -->
    <div class="pattern-attachment-img lazyload" style="background-image: url(https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/u=1677669875,922758600&amp;afaffm=26&amp;gp=0.jpg);" src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/loader/orange.progress-bar-stripe-loader.svg" data-src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/u=1677669875,922758600&amp;afaffm=26&amp;gp=0.jpg">
    </div>
    <header class="pattern-header single-header">
      <h1 class="entry-title">
      编码5五分钟，命名两小时？不可能的！</h1>
      <p class="entry-census">
        <span>
          <a href="www.gcweb.top">
            <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/21.jpg">
          </a>
        </span>
        <span>
          <a href="www.gcweb.top">耿超</a>
        </span>
        <span class="bull">
        ·</span>
        2020-3-28<span class="bull">
        ·</span>
      <span id="busuanzi_value_page_pv"></span>次阅读</p>
    </header>
  </div>

<div id="content" class="site-content">
  <div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">
      <article id="post-1" class="post-1 post type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized">
        <div class="toc"></div>
        <!--<div class="toc-entry-content"><!-- 套嵌目录使用（主要为了支援评论）-->
        
        <div class="entry-content">
          <p>每个公司都有不同的标准，目的是为了保持统一，减少沟通成本，提升团队研发效能。所以本文中是笔者结合阿里巴巴开发规范，以及工作中的见闻针对Java领域相关命名进行整理和总结，仅供参考。</p>
<h2 id="一、Java中的命名规范"><a href="#一、Java中的命名规范" class="headerlink" title="一、Java中的命名规范"></a>一、Java中的命名规范</h2><p>好的命名能体现出代码的特征，含义或者是用途，让阅读者可以根据名称的含义快速厘清程序的脉络。不同语言中采用的命名形式大相径庭，Java中常用到的命名形式共有三种，既首字母大写的UpperCamelCase，首字母小写的lowerCamelCase以及全部大写的并用下划线分割单词的UPPERCAMELUNSER_SCORE。通常约定，<strong>类一般采用大驼峰命名，方法和局部变量使用小驼峰命名，而大写下划线命名通常是常量和枚举中使用。</strong></p>
<table>
<thead>
<tr>
<th>类型(名)</th>
<th>约束</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>项目</td>
<td>全部小写多个单词用中划线分隔‘-’</td>
<td>spring-cloud</td>
</tr>
<tr>
<td>包</td>
<td>全部小写</td>
<td>com.alibaba.fastjson</td>
</tr>
<tr>
<td>类</td>
<td>单词首字母大写</td>
<td>Feature,FieldDeserializer</td>
</tr>
<tr>
<td>变量</td>
<td>首字母小写多个单词组成时，除首个单词其他单词首字母都要大写</td>
<td>password, userName</td>
</tr>
<tr>
<td>常量</td>
<td>全部大写，多个单词，用’_’分隔</td>
<td>CACHEEXPIREDTIME</td>
</tr>
<tr>
<td>方法</td>
<td>同变量</td>
<td>read(), getById(Long id)</td>
</tr>
</tbody>
</table>
<h2 id="二、包命名"><a href="#二、包命名" class="headerlink" title="二、包命名"></a>二、包命名</h2><p><strong>包名</strong>统一使用<strong>小写</strong>，<strong>点分隔符</strong>之间有且仅有一个自然语义的英文单词或者多个单词自然连接到一块（如 springframework，deepspace不需要使用任何分割）。包名统一使用单数形式，如果类命有复数含义，则可以使用复数形式。</p>
<p>包名的构成可以分为以下几四部分【前缀】 【发起者名】【项目名】【模块名】。常见的前缀可以分为以下几种：</p>
<table>
<thead>
<tr>
<th>前缀</th>
<th>例</th>
<th>含义</th>
</tr>
</thead>
<tbody>
<tr>
<td>indi或onem</td>
<td>indi.发起者名.项目名.模块名.……</td>
<td>个体项目个人发起，但非自己独自完成可公开或私有项目，copyright主要属于发起者。</td>
</tr>
<tr>
<td>pers</td>
<td>pers.个人名.项目名.模块名.……</td>
<td>个人项目指个人发起，独自完成，可分享的项目copyright主要属于个人</td>
</tr>
<tr>
<td>priv</td>
<td>priv.个人名.项目名.模块名.……</td>
<td>私有项目，指个人发起，独自完成非公开的私人使用的项目，copyright属于个人。</td>
</tr>
<tr>
<td>team</td>
<td>team.团队名.项目名.模块名.……</td>
<td>团队项目，指由团队发起并由该团队开发的项目copyright属于该团队所有</td>
</tr>
<tr>
<td>顶级域名</td>
<td>com.公司名.项目名.模块名.……</td>
<td>公司项目copyright由项目发起的公司所有</td>
</tr>
</tbody>
</table>
<h2 id="三、类命名"><a href="#三、类命名" class="headerlink" title="三、类命名"></a>三、类命名</h2><p><strong>类名使用大驼峰命名形式</strong>，类命通常时<strong>名词或名词短语</strong>，接口名除了用名词和名词短语以外，还可以使用形容词或形容词短语，如Cloneable，Callable等，表示实现该接口的类有某种功能或能力。对于测试类则以它要测试的类开头，以Test结尾，如HashMapTest。</p>
<p>对于一些特殊特有名词缩写也可以使用全大写命名，比如XMLHttpRequest，不过笔者认为缩写三个字母以内都大写，超过三个字母则按照要给单词算。这个没有标准如阿里巴巴中fastjson用JSONObject作为类命，而google则使用JsonObjectRequest命名，对于这种特殊的缩写，原则是统一就好。</p>
<table>
<thead>
<tr>
<th>属性(类)</th>
<th>约束</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>抽象</td>
<td>Abstract 或Base 开头</td>
<td>BaseUserService</td>
</tr>
<tr>
<td>枚举</td>
<td>Enum 作为后缀</td>
<td>OSType</td>
</tr>
<tr>
<td>工具</td>
<td>Utils作为后缀</td>
<td>StringUtils</td>
</tr>
<tr>
<td>异常</td>
<td>Exception结尾</td>
<td>RuntimeException</td>
</tr>
<tr>
<td>接口实现</td>
<td>接口名+ Impl</td>
<td>UserServiceImpl</td>
</tr>
<tr>
<td>领域模型相</td>
<td>/DO/DTO/VO/DAO</td>
<td>正例：UserDAO反例：UserDao</td>
</tr>
<tr>
<td>设计模式相关</td>
<td>Builder，Factory等</td>
<td>当使用到设计模式时要使用对应的设计模式作为后缀如ThreadFactory</td>
</tr>
<tr>
<td>处理特定功能</td>
<td>Handler，PredicateValidator</td>
<td>表示处理器，校验器，断言这些类工厂还有配套的方法名如handle，predicate，validate</td>
</tr>
<tr>
<td>测试</td>
<td>Test后缀</td>
<td>UserServiceTest表示用来测试UserService类的</td>
</tr>
<tr>
<td>MVC分层</td>
<td>Controller，ServiceServiceImpl，DAO后缀</td>
<td>UserManageControllerUserManageDAO</td>
</tr>
</tbody>
</table>
<h2 id="四、方法"><a href="#四、方法" class="headerlink" title="四、方法"></a>四、方法</h2><p><strong>方法命名采用小驼峰的形式</strong>，首字小写，往后的每个单词首字母都要大写。和类名不同的是，方法命名一般为<strong>动词或动词短语</strong>，与参数或参数名共同组成动宾短语，即动词 + 名词。一个好的函数名一般能通过名字直接获知该函数实现什么样的功能。</p>
<h3 id="4-1-返回真伪值的方法"><a href="#4-1-返回真伪值的方法" class="headerlink" title="4.1 返回真伪值的方法"></a>4.1 返回真伪值的方法</h3><p>注：pre- prefix前缀，suf- suffix后缀，alo-alone 单独使用</p>
<table>
<thead>
<tr>
<th>位置</th>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>pre</td>
<td>is</td>
<td>对象是否符合期待的状态</td>
<td>isValid</td>
</tr>
<tr>
<td>pre</td>
<td>can</td>
<td>对象<strong>能否执行</strong>所期待的动作</td>
<td>canRemove</td>
</tr>
<tr>
<td>pre</td>
<td>should</td>
<td>调用方执行某个命令或方法是<strong>好还是不好<strong>**</strong></strong>应不应该<strong>，或者说</strong>推荐还是不推荐**</td>
<td>shouldMigrate</td>
</tr>
<tr>
<td>pre</td>
<td>has</td>
<td>对象<strong>是否持有<em>**</em></strong>所期待的数据和属性</td>
<td>hasObservers</td>
</tr>
<tr>
<td>pre</td>
<td>needs</td>
<td>调用方<strong>是否需要<em>**</em></strong>执行某个命令或方法</td>
<td>needsMigrate</td>
</tr>
</tbody>
</table>
<h3 id="4-2-用来检查的方法"><a href="#4-2-用来检查的方法" class="headerlink" title="4.2 用来检查的方法"></a>4.2 用来检查的方法</h3><table>
<thead>
<tr>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>ensure</td>
<td>检查是否为期待的状态不是则抛出异常或返回error code</td>
<td>ensureCapacity</td>
</tr>
<tr>
<td>validate</td>
<td>检查是否为正确的状态不是则抛出异常或返回error code</td>
<td>validateInputs</td>
</tr>
</tbody>
</table>
<h3 id="4-3-按需求才执行的方法"><a href="#4-3-按需求才执行的方法" class="headerlink" title="4.3 按需求才执行的方法"></a>4.3 按需求才执行的方法</h3><table>
<thead>
<tr>
<th>位置</th>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>suf</td>
<td>IfNeeded</td>
<td>需要的时候执行不需要则什么都不做</td>
<td>drawIfNeeded</td>
</tr>
<tr>
<td>pre</td>
<td>might</td>
<td>同上</td>
<td>mightCreate</td>
</tr>
<tr>
<td>pre</td>
<td>try</td>
<td>尝试执行失败时抛出异常或是返回errorcode</td>
<td>tryCreate</td>
</tr>
<tr>
<td>suf</td>
<td>OrDefault</td>
<td>尝试执行失败时返回默认值</td>
<td>getOrDefault</td>
</tr>
<tr>
<td>suf</td>
<td>OrElse</td>
<td>尝试执行失败时返回实际参数中指定的值</td>
<td>getOrElse</td>
</tr>
<tr>
<td>pre</td>
<td>force</td>
<td>强制尝试执行error抛出异常或是返回值</td>
<td>forceCreate, forceStop</td>
</tr>
</tbody>
</table>
<h3 id="4-4-异步相关方法"><a href="#4-4-异步相关方法" class="headerlink" title="4.4 异步相关方法"></a>4.4 异步相关方法</h3><table>
<thead>
<tr>
<th>位置</th>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>pre</td>
<td>blocking</td>
<td>线程阻塞方法</td>
<td>blockingGetUser</td>
</tr>
<tr>
<td>suf</td>
<td>InBackground</td>
<td>执行在后台线程</td>
<td>doInBackground</td>
</tr>
<tr>
<td>suf</td>
<td>Async</td>
<td>异步方法</td>
<td>sendAsync</td>
</tr>
<tr>
<td>suf</td>
<td>Sync</td>
<td>同步方法</td>
<td>sendSync</td>
</tr>
<tr>
<td>pre/alo</td>
<td>schedule</td>
<td>Job和Task放入队列</td>
<td>schedule, scheduleJob</td>
</tr>
<tr>
<td>pre/alo</td>
<td>post</td>
<td>同上</td>
<td>postJob</td>
</tr>
<tr>
<td>pre/alo</td>
<td>execute</td>
<td>执行异步或同步方法</td>
<td>execute,executeTask</td>
</tr>
<tr>
<td>pre/alo</td>
<td>start</td>
<td>同上</td>
<td>star,tstartJob</td>
</tr>
<tr>
<td>pre/alo</td>
<td>cancel</td>
<td>停止异步方法</td>
<td>cance,cancelJob</td>
</tr>
<tr>
<td>pre/alo</td>
<td>stop</td>
<td>同上</td>
<td>stop,stopJob</td>
</tr>
</tbody>
</table>
<h3 id="4-5-回调方法"><a href="#4-5-回调方法" class="headerlink" title="4.5 回调方法"></a>4.5 回调方法</h3><table>
<thead>
<tr>
<th>位置</th>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>pre</td>
<td>on</td>
<td>事件发生时执行</td>
<td>onCompleted</td>
</tr>
<tr>
<td>pre</td>
<td>before</td>
<td>事件发生前执行</td>
<td>beforeUpdate</td>
</tr>
<tr>
<td>pre</td>
<td>pre</td>
<td>同上</td>
<td>preUpdate</td>
</tr>
<tr>
<td>pre</td>
<td>will</td>
<td>同上</td>
<td>willUpdate</td>
</tr>
<tr>
<td>pre</td>
<td>after</td>
<td>事件发生后执行</td>
<td>afterUpdate</td>
</tr>
<tr>
<td>pre</td>
<td>post</td>
<td>同上</td>
<td>postUpdate</td>
</tr>
<tr>
<td>pre</td>
<td>did</td>
<td>同上</td>
<td>didUpdate</td>
</tr>
<tr>
<td>pre</td>
<td>should</td>
<td>确认事件是否可以执行</td>
<td>shouldUpdate</td>
</tr>
</tbody>
</table>
<h3 id="4-6-操作对象生命周期的方法"><a href="#4-6-操作对象生命周期的方法" class="headerlink" title="4.6 操作对象生命周期的方法"></a>4.6 操作对象生命周期的方法</h3><table>
<thead>
<tr>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>initialize</td>
<td>初始化或延迟初始化使用</td>
<td>initialize</td>
</tr>
<tr>
<td>pause</td>
<td>暂停</td>
<td>onPause , pause</td>
</tr>
<tr>
<td>stop</td>
<td>停止</td>
<td>onStop, stop</td>
</tr>
<tr>
<td>abandon</td>
<td>销毁的替代</td>
<td>abandon</td>
</tr>
<tr>
<td>destroy</td>
<td>同上</td>
<td>destroy</td>
</tr>
<tr>
<td>dispose</td>
<td>同上</td>
<td>dispose</td>
</tr>
</tbody>
</table>
<h3 id="4-7-与集合操作相关的方法"><a href="#4-7-与集合操作相关的方法" class="headerlink" title="4.7 与集合操作相关的方法"></a>4.7 与集合操作相关的方法</h3><table>
<thead>
<tr>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>contains</td>
<td>是包含指定对象相同的对象</td>
<td>contains</td>
</tr>
<tr>
<td>add</td>
<td>添加</td>
<td>addJob</td>
</tr>
<tr>
<td>append</td>
<td>添加</td>
<td>appendJob</td>
</tr>
<tr>
<td>insert</td>
<td>插入到下标n</td>
<td>insertJob</td>
</tr>
<tr>
<td>put</td>
<td>添加与key对应的元素</td>
<td>putJob</td>
</tr>
<tr>
<td>remove</td>
<td>移除元素</td>
<td>removeJob</td>
</tr>
<tr>
<td>enqueue</td>
<td>添加到队列的最末位</td>
<td>enqueueJob</td>
</tr>
<tr>
<td>dequeue</td>
<td>从队列中头部取出并移除</td>
<td>dequeueJob</td>
</tr>
<tr>
<td>push</td>
<td>添加到栈头</td>
<td>pushJob</td>
</tr>
<tr>
<td>pop</td>
<td>从栈头取出并移除</td>
<td>popJob</td>
</tr>
<tr>
<td>peek</td>
<td>从栈头取出但不移除</td>
<td>peekJob</td>
</tr>
<tr>
<td>find</td>
<td>寻找符合条件的某物</td>
<td>findById</td>
</tr>
</tbody>
</table>
<h3 id="4-8-与数据相关的方法"><a href="#4-8-与数据相关的方法" class="headerlink" title="4.8 与数据相关的方法"></a>4.8 与数据相关的方法</h3><table>
<thead>
<tr>
<th>单词</th>
<th>意义</th>
<th>例</th>
</tr>
</thead>
<tbody>
<tr>
<td>create</td>
<td>新创建</td>
<td>createAccount</td>
</tr>
<tr>
<td>new</td>
<td>新创建</td>
<td>newAccount</td>
</tr>
<tr>
<td>from</td>
<td>从既有的某物新建或是从其他的数据新建</td>
<td>fromConfig</td>
</tr>
<tr>
<td>to</td>
<td>转换</td>
<td>toString</td>
</tr>
<tr>
<td>update</td>
<td>更新既有某物</td>
<td>updateAccount</td>
</tr>
<tr>
<td>load</td>
<td>读取</td>
<td>loadAccount</td>
</tr>
<tr>
<td>fetch</td>
<td>远程读取</td>
<td>fetchAccount</td>
</tr>
<tr>
<td>delete</td>
<td>删除</td>
<td>deleteAccount</td>
</tr>
<tr>
<td>remove</td>
<td>删除</td>
<td>removeAccount</td>
</tr>
<tr>
<td>save</td>
<td>保存</td>
<td>saveAccount</td>
</tr>
<tr>
<td>store</td>
<td>保存</td>
<td>storeAccount</td>
</tr>
<tr>
<td>commit</td>
<td>保存</td>
<td>commitChange</td>
</tr>
<tr>
<td>apply</td>
<td>保存或应用</td>
<td>applyChange</td>
</tr>
<tr>
<td>clear</td>
<td>清除或是恢复到初始状态</td>
<td>clearAll</td>
</tr>
<tr>
<td>reset</td>
<td>清除或是恢复到初始状态</td>
<td>resetAll</td>
</tr>
</tbody>
</table>
<h3 id="4-9-成对出现的动词"><a href="#4-9-成对出现的动词" class="headerlink" title="4.9 成对出现的动词"></a>4.9 成对出现的动词</h3><table>
<thead>
<tr>
<th>单词</th>
<th>意义</th>
</tr>
</thead>
<tbody>
<tr>
<td>get获取</td>
<td>set 设置</td>
</tr>
<tr>
<td>add 增加</td>
<td>remove 删除</td>
</tr>
<tr>
<td>create 创建</td>
<td>destory 移除</td>
</tr>
<tr>
<td>start 启动</td>
<td>stop 停止</td>
</tr>
<tr>
<td>open 打开</td>
<td>close 关闭</td>
</tr>
<tr>
<td>read 读取</td>
<td>write 写入</td>
</tr>
<tr>
<td>load 载入</td>
<td>save 保存</td>
</tr>
<tr>
<td>create 创建</td>
<td>destroy 销毁</td>
</tr>
<tr>
<td>begin 开始</td>
<td>end 结束</td>
</tr>
<tr>
<td>backup 备份</td>
<td>restore 恢复</td>
</tr>
<tr>
<td>import 导入</td>
<td>export 导出</td>
</tr>
<tr>
<td>split 分割</td>
<td>merge 合并</td>
</tr>
<tr>
<td>inject 注入</td>
<td>extract 提取</td>
</tr>
<tr>
<td>attach 附着</td>
<td>detach 脱离</td>
</tr>
<tr>
<td>bind 绑定</td>
<td>separate 分离</td>
</tr>
<tr>
<td>view 查看</td>
<td>browse 浏览</td>
</tr>
<tr>
<td>edit 编辑</td>
<td>modify 修改</td>
</tr>
<tr>
<td>select 选取</td>
<td>mark 标记</td>
</tr>
<tr>
<td>copy 复制</td>
<td>paste 粘贴</td>
</tr>
<tr>
<td>undo 撤销</td>
<td>redo 重做</td>
</tr>
<tr>
<td>insert 插入</td>
<td>delete 移除</td>
</tr>
<tr>
<td>add 加入</td>
<td>append 添加</td>
</tr>
<tr>
<td>clean 清理</td>
<td>clear 清除</td>
</tr>
<tr>
<td>index 索引</td>
<td>sort 排序</td>
</tr>
<tr>
<td>find 查找</td>
<td>search 搜索</td>
</tr>
<tr>
<td>increase 增加</td>
<td>decrease 减少</td>
</tr>
<tr>
<td>play 播放</td>
<td>pause 暂停</td>
</tr>
<tr>
<td>launch 启动</td>
<td>run 运行</td>
</tr>
<tr>
<td>compile 编译</td>
<td>execute 执行</td>
</tr>
<tr>
<td>debug 调试</td>
<td>trace 跟踪</td>
</tr>
<tr>
<td>observe 观察</td>
<td>listen 监听</td>
</tr>
<tr>
<td>build 构建</td>
<td>publish 发布</td>
</tr>
<tr>
<td>input 输入</td>
<td>output 输出</td>
</tr>
<tr>
<td>encode 编码</td>
<td>decode 解码</td>
</tr>
<tr>
<td>encrypt 加密</td>
<td>decrypt 解密</td>
</tr>
<tr>
<td>compress 压缩</td>
<td>decompress 解压缩</td>
</tr>
<tr>
<td>pack 打包</td>
<td>unpack 解包</td>
</tr>
<tr>
<td>parse 解析</td>
<td>emit 生成</td>
</tr>
<tr>
<td>connect 连接</td>
<td>disconnect 断开</td>
</tr>
<tr>
<td>send 发送</td>
<td>receive 接收</td>
</tr>
<tr>
<td>download 下载</td>
<td>upload 上传</td>
</tr>
<tr>
<td>refresh 刷新</td>
<td>synchronize 同步</td>
</tr>
<tr>
<td>update 更新</td>
<td>revert 复原</td>
</tr>
<tr>
<td>lock 锁定</td>
<td>unlock 解锁</td>
</tr>
<tr>
<td>check out 签出</td>
<td>check in 签入</td>
</tr>
<tr>
<td>submit 提交</td>
<td>commit 交付</td>
</tr>
<tr>
<td>push 推</td>
<td>pull 拉</td>
</tr>
<tr>
<td>expand 展开</td>
<td>collapse 折叠</td>
</tr>
<tr>
<td>begin 起始</td>
<td>end 结束</td>
</tr>
<tr>
<td>start 开始</td>
<td>finish 完成</td>
</tr>
<tr>
<td>enter 进入</td>
<td>exit 退出</td>
</tr>
<tr>
<td>abort 放弃</td>
<td>quit 离开</td>
</tr>
<tr>
<td>obsolete 废弃</td>
<td>depreciate 废旧</td>
</tr>
<tr>
<td>collect 收集</td>
<td>aggregate 聚集</td>
</tr>
</tbody>
</table>
<h2 id="五、变量-amp-常量命名"><a href="#五、变量-amp-常量命名" class="headerlink" title="五、变量&amp;常量命名"></a>五、变量&amp;常量命名</h2><h3 id="5-1-变量命名"><a href="#5-1-变量命名" class="headerlink" title="5.1 变量命名"></a>5.1 变量命名</h3><p>变量是指在程序运行中可以改变其值的量，包括成员变量和局部变量。变量名由多单词组成时，第一个单词的首字母小写，其后单词的首字母大写，俗称骆驼式命名法（也称驼峰命名法），如 computedValues，index、变量命名时，尽量简短且能清楚的表达变量的作用，命名体现具体的业务含义即可。</p>
<p>变量名不应以下划线或美元符号开头，尽管这在语法上是允许的。变量名应简短且富于描述。变量名的选用应该易于记忆，即，能够指出其用途。尽量避免单个字符的变量名，除非是一次性的临时变量。pojo中的布尔变量，都不要加is(数据库中的布尔字段全都要加 is_ 前缀)。</p>
<h3 id="5-2-常量命名"><a href="#5-2-常量命名" class="headerlink" title="5.2 常量命名"></a>5.2 常量命名</h3><p>常量命名CONSTANT_CASE，一般采用全部大写（作为方法参数时除外），单词间用下划线分割。那么什么是常量呢？</p>
<p>常量是在作用域内保持不变的值，一般使用final进行修饰。一般分为三种，全局常量（public static final修饰），类内常量（private static final 修饰）以及局部常量（方法内，或者参数中的常量），局部常量比较特殊，通常采用小驼峰命名即可。</p>
<pre><code class="java">/**
 * 一个demo
 *
 * @author Jann Lee
 * @date 2019-12-07 00:25
 **/
public class HelloWorld {


/**
     * 局部常量(正例)
     */

public static final long USER_MESSAGE_CACHE_EXPIRE_TIME = 3600;

/**
     * 局部常量(反例，命名不清晰）
     */

public static final long MESSAGE_CACHE_TIME =3600;

/**
     * 全局常量
     */

private static final String ERROR_MESSAGE =&quot; error message&quot;;

/**
     * 成员变量
     */

private

int
 currentUserId
;


/**
     * 控制台打印 {@code message} 信息
     *
     * @param message 消息体，局部常量
     */

public void sayHello(final String message){
        System.out.println(&quot;Hello world!&quot;);

}

}
</code></pre>
<p>常量一般都有自己的业务含义,<strong>不要害怕长度过长而进行省略或者缩写</strong>。如，用户消息缓存过期时间的表示，那种方式更佳清晰，交给你来评判。</p>
<h2 id="通用命名规则"><a href="#通用命名规则" class="headerlink" title="通用命名规则"></a>通用命名规则</h2><ol>
<li>尽量不要使用拼音；<strong>杜绝拼音和英文混用</strong>。对于一些通用的表示或者难以用英文描述的可以采用拼音，一旦采用拼音就坚决不能和英文混用。正例：BeiJing， HangZhou 反例：validateCanShu</li>
<li>命名过程中尽量不要出现特殊的字符，常量除外。</li>
<li>尽量不要和jdk或者框架中已存在的类重名，也不能使用java中的关键字命名。</li>
<li>妙用介词，如for(可以用同音的4代替), to(可用同音的2代替), from, with，of等。如类名采用User4RedisDO，方法名getUserInfoFromRedis，convertJson2Map等。</li>
</ol>
<h2 id="六、代码注解"><a href="#六、代码注解" class="headerlink" title="六、代码注解"></a>六、代码注解</h2><h3 id="6-1-注解的原则"><a href="#6-1-注解的原则" class="headerlink" title="6.1 注解的原则"></a>6.1 注解的原则</h3><p>好的命名增加代码阅读性，代码的命名往往有严格的限制。而注解不同，程序员往往可以自由发挥，单并不意味着可以为所欲为之胡作非为。优雅的注解通常要满足三要素。</p>
<ol>
<li>Nothing is strange 没有注解的代码对于阅读者非常不友好，哪怕代码写的在清除，阅读者至少从心理上会有抵触，更何况代码中往往有许多复杂的逻辑，所以一定要写注解，不仅要记录代码的逻辑，还有说清楚修改的逻辑。</li>
<li>Less is more 从代码维护角度来讲，代码中的注解一定是精华中的精华。合理清晰的命名能让代码易于理解，对于逻辑简单且命名规范，能够清楚表达代码功能的代码不需要注解。滥用注解会增加额外的负担，更何况大部分都是废话。</li>
</ol>
<pre><code class="java">// 根据id获取信息【废话注解】getMessageById(id)
</code></pre>
<ol>
<li>Advance with the time 注解应该随着代码的变动而改变，注解表达的信息要与代码中完全一致。通常情况下修改代码后一定要修改注解。</li>
</ol>
<h3 id="6-2-注解格式"><a href="#6-2-注解格式" class="headerlink" title="6.2 注解格式"></a>6.2 注解格式</h3><p>注解大体上可以分为两种，一种是javadoc注解，另一种是简单注解。javadoc注解可以生成JavaAPI为外部用户提供有效的支持javadoc注解通常在使用IDEA，或者Eclipse等开发工具时都可以自动生成，也支持自定义的注解模板，仅需要对对应的字段进行解释。参与同一项目开发的同学，尽量设置成相同的注解模板。</p>
<h4 id="a-包注解"><a href="#a-包注解" class="headerlink" title="a. 包注解"></a>a. 包注解</h4><p>包注解在工作中往往比较特殊，通过包注解可以快速知悉当前包下代码是用来实现哪些功能，强烈建议工作中加上，尤其是对于一些比较复杂的包，包注解一般在包的根目录下，名称统一为package-info.java。</p>
<pre><code class="java">/** * 落地也质量检测 * 1. 用来解决什么问题 * 对广告主投放的广告落地页进行性能检测，模拟不同的系统，如Android，IOS等; 模拟不同的网络：2G，3G，4G，wifi等 * * 2. 如何实现 * 基于chrome浏览器，用chromedriver驱动浏览器，设置对应的网络，OS参数，获取到浏览器返回结果。 * * 注意：网络环境配置信息{@link cn.mycookies.landingpagecheck.meta.NetWorkSpeedEnum}目前使用是常规速度，可以根据实际情况进行调整 * * @author cruder * @time 2019/12/7 20:3 下午 */package cn.mycookies.landingpagecheck;
</code></pre>
<h4 id="b-类注接"><a href="#b-类注接" class="headerlink" title="b. 类注接"></a>b. 类注接</h4><p>javadoc注解中，每个类都必须有注解。</p>
<pre><code class="java">/*** Copyright (C), 2019-2020, Jann  balabala...** 类的介绍：这是一个用来做什么事情的类，有哪些功能，用到的技术.....** @author   类创建者姓名 保持对齐* @date     创建日期 保持对齐* @version  版本号 保持对齐*/
</code></pre>
<h4 id="c-属性注解"><a href="#c-属性注解" class="headerlink" title="c. 属性注解"></a>c. 属性注解</h4><p>在每个属性前面必须加上属性注释，通常有一下两种形式，至于怎么选择，你高兴就好，不过一个项目中要保持统一。</p>
<pre><code class="java">/** 提示信息 */private String userName;/** * 密码 */private String password;
</code></pre>
<h4 id="d-方法注释"><a href="#d-方法注释" class="headerlink" title="d. 方法注释"></a>d. 方法注释</h4><p>在每个方法前面必须加上方法注释，对于方法中的每个参数，以及返回值都要有说明。</p>
<pre><code class="java">/**  * 方法的详细说明，能干嘛，怎么实现的，注意事项...  *  * @param xxx      参数1的使用说明， 能否为null  * @return 返回结果的说明， 不同情况下会返回怎样的结果  * @throws 异常类型   注明从此类方法中抛出异常的说明  */
</code></pre>
<h4 id="e-构造方法注释"><a href="#e-构造方法注释" class="headerlink" title="e. 构造方法注释"></a>e. 构造方法注释</h4><p>在每个构造方法前面必须加上注释，注释模板如下：</p>
<pre><code class="java">/**  * 构造方法的详细说明  *  * @param xxx      参数1的使用说明， 能否为null  * @throws 异常类型   注明从此类方法中抛出异常的说明  */
</code></pre>
<p>而简单注解往往是需要工程师字节定义，在使用注解时应该注意一下几点：</p>
<ol>
<li>枚举类的各个属性值都要使用注解，枚举可以理解为是常量，通常不会发生改变，通常会被在多个地方引用，对枚举的修改和添加属性通常会带来很大的影响。</li>
<li>保持排版整洁，不要使用行尾注释；双斜杠和星号之后要用1个空格分隔。</li>
</ol>
<pre><code class="java">int id = 1;// 反例：不要使用行尾注释//反例：换行符与注释之间没有缩进int age = 18;// 正例：姓名String name;/** * 1. 多行注释 * * 2. 对于不同的逻辑说明，可以用空行分隔 */
</code></pre>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>无论是命名和注解，他们的目的都是为了让代码和工程师进行对话，增强代码的可读性，可维护性。优秀的代码往往能够见名知意，注解往往是对命名的补充和完善。</p>

        </div>
        <!-- .entry-content -->
        <div class="single-reward">
          <div class="reward-open">赏
            <div class="reward-main">
              <ul class="reward-row">
                <li class="alipay-code"><img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/custom/donate/AliPayQR.jpg"></li>
                <li class="wechat-code"><img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/custom/donate/WeChanQR.jpg"></li>
              </ul>
            </div>
          </div>
        </div>
        <div style="text-align:center; width: 100%" class="social-share share-mobile" data-disabled="diandian, tencent"></div>
        <footer class="post-footer">
          <div class="post-lincenses"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="nofollow"><i class="fa fa-creative-commons" aria-hidden="true"></i> 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a></div>
          <div class="post-tags">
          </div>
          <div class="post-share">
            <div class="social-share sharehidden share-component"></div>
            <i class="iconfont show-share icon-forward"></i>
          </div>
        </footer><!-- .entry-footer -->
      </article>
      <!-- #post-## -->
      <div class="toc" style="background: none;"></div>
      <section class="post-squares nextprev">
        
        
          
            <div class="post-nepre full next">
          
            <a href="/2020/03/24/开源项目结构/" rel="next">
              <div class="background">
                <img class="lazyload" src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/loader/orange.progress-bar-stripe-loader.svg" data-src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/aab71d2004090a4b723f4f0fc7d9555f.gif" style="width: 100%; height: 100%; object-fit: cover; pointer-events: none;" onerror="imgError(this,3)" src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/aab71d2004090a4b723f4f0fc7d9555f.gif">
              </div>
              <span class="label">
              Next Post</span>
              <div class="info">
                <h3>
                开源项目结构</h3>
                <hr>
              </div>
            </a>
          </div>
        
      </section>
      
<div id="vcomments"></div>
<script>
  window.onload = function(){
      var valine = new Valine();
      valine.init({
        el: '#vcomments',
        appId: "aeY1WNVHlNPxnev04uP4OGiN-gzGzoHsz",
        appKey: "eC65yOIwHWdj1SI18Dc25mV2",
        path: window.location.pathname,
        placeholder: "你是我一生只会遇见一次的惊喜 ..."
      })
  }
</script>

      <section class="author-profile">
        <div class="info" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
          <a href="www.gcweb.top" class="profile gravatar"><img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/21.jpg" itemprop="image" alt="耿超" height="70" width="70"></a>
          <div class="meta">
            <span class="title">Author</span>
            <h3 itemprop="name">
            <a href="www.gcweb.top" itemprop="url" rel="author">耿超</a>
            </h3>
          </div>
        </div>
        <hr>
        <p><i class="iconfont icon-write"></i>Just Do It</p>
      </section>
    </main><!-- #main -->
  </div><!-- #primary -->
</div>



    </div>    
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="请输入关键词..."/>
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            // PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
    <!-- <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2020 耿超<br>
      powered_by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer> -->



<footer id="colophon" class="site-footer" role="contentinfo">
  <div class="site-info">
    <div class="footertext">
      <div class="img-preload">
        <img src="https://cdn.jsdelivr.net/gh/honjun/cdn@1.6/img/other/wordpress-rotating-ball-o.svg">
        <img src="https://cdn.jsdelivr.net/gh/honjun/cdn@1.6/img/other/disqus-preloader.svg">
      </div>
      <p style="color: #666666;">&copy 2019</p>
    </div>
    <div class="footer-device">
    <p style="font-family: 'Ubuntu', sans-serif;">
        <span style="color: #b9b9b9;">经历暴风雨后<a href="https://github.com/honjun/hexo-theme-sakura" target="_blank" style="color: #b9b9b9;;text-decoration: underline dotted rgba(0, 0, 0, .1);">.</a> <i class="iconfont icon-sakura rotating" style="color: #ffc0cb;display:inline-block"></i>终将站在最高处<a href="https://2heng.xin/" target="_blank" style="color: #b9b9b9;;text-decoration: underline dotted rgba(0, 0, 0, .1);">.</a>&✌✌✌✌<a href="https://www.hojun.cn/" target="_blank" style="color: #b9b9b9;;text-decoration: underline dotted rgba(0, 0, 0, .1);">耿超</a></a>
        </span>
      </p>
    </div>
  </div><!-- .site-info -->



    <!--新加-->
    <span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span><script>
        var now = new Date();
        function createtime() {
            var grt= new Date("06/06/2019 16:44:00");//此处修改你的建站时间或者网站上线时间
            now.setTime(now.getTime()+250);
            days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days);
            hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours);
            if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
            mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;}
            seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
            snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;}
            document.getElementById("timeDate").innerHTML = "本站虽每天被经受大量黑客攻击, 但因站长技术所向披靡, 已风雨兼程,苦苦运行 "+dnum+" 天 ";
            document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒 ！！";
            var t =document.getElementById("timeDate");
            var times =document.getElementById("times");
            t.style.color="green";
            times.style.color="green";

            /*最下面的访问人数统计的样式*/
            var pv =document.getElementById("busuanzi_container_site_pv");
            var uv =document.getElementById("busuanzi_value_site_uv");
            pv.style.right ="200px";

            uv.style.content  ="content";

        }
        setInterval("createtime()",250);</script>

</footer>



<!-- <script src="/js/tocbot.js"></script> -->
<script src="//code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.6/dist/jquery.fancybox.min.js"></script>


<script type="text/javascript" src="/js/lib.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script type="text/javascript" src="/js/InsightSearch.js"></script>
<script type="text/javascript" src="/js/jquery.fancybox.min.js"></script>
<script type="text/javascript" src="/js/zoom.min.js"></script>
<script type="text/javascript" src="/js/sakura-app.js"></script>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='//unpkg.com/valine@1.3.4/dist/Valine.min.js'></script>
<script src="/js/botui.js"></script>
<!-- 不蒜子 网页计数器 -->
<script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script> -->
<script type="text/javascript">
/* <![CDATA[ */
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
  var Poi = {"pjax":"1","movies":{"url": "https://cdn.jsdelivr.net/gh/geng-chao/sp@1.0","name":"j.mp4","live":"close"},"windowheight":"fixed","codelamp":"close","ajaxurl":"","order":"asc","formpostion":"bottom"};
} else {
  var Poi = {"pjax":"1","movies":{"url": "https://cdn.jsdelivr.net/gh/geng-chao/sp@1.0","name":"j.mp4","live":"open"},"windowheight":"auto","codelamp":"close","ajaxurl":"","order":"asc","formpostion":"bottom"};
}
/* ]]> */

</script>
<script>
$(document).ready(function() {
  if ($(".toc").length > 0 && document.body.clientWidth > 1200) {
    if ($(".pattern-center").length > 0) { //有图的情况
      tocbot.init({
          // Where to render the table of contents.
          tocSelector: '.toc', // 放置目录的容器
          // Where to grab the headings to build the table of contents.
          contentSelector: '.entry-content', // 正文内容所在
          // Which headings to grab inside of the contentSelector element.
          scrollSmooth: true,
          headingSelector: 'h1, h2, h3, h4, h5', // 需要索引的标题级别
          headingsOffset: -400,
          scrollSmoothOffset: -85
      });
    } else {
      tocbot.init({
          // Where to render the table of contents.
          tocSelector: '.toc', // 放置目录的容器
          // Where to grab the headings to build the table of contents.
          contentSelector: '.entry-content', // 正文内容所在
          // Which headings to grab inside of the contentSelector element.
          scrollSmooth: true,
          headingSelector: 'h1, h2, h3, h4, h5', // 需要索引的标题级别
          headingsOffset: -85,
          scrollSmoothOffset: -85
      });
    }
    var offsetTop = $('.toc').offset().top - 95;
    window.onscroll = function() {
      var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      if (scrollTop >= offsetTop) {
        $('.toc').addClass('toc-fixed');
      } else {
        $('.toc').removeClass('toc-fixed');
      }
    }
  }
});
</script>


<!--底部动态字体-->
<div id="binft"></div>
<script>
    var binft = function (r) {
        function t() {
            return b[Math.floor(Math.random() * b.length)]
        }
        function e() {
            return String.fromCharCode(94 * Math.random() + 33)
        }
        function n(r) {
            for (var n = document.createDocumentFragment(), i = 0; r > i; i++) {
                var l = document.createElement("span");
                l.textContent = e(), l.style.color = t(), n.appendChild(l)
            }
            return n
        }
        function i() {
            var t = o[c.skillI];
            c.step ? c.step-- : (c.step = g, c.prefixP < l.length ? (c.prefixP >= 0 && (c.text += l[c.prefixP]), c.prefixP++) : "forward" === c.direction ? c.skillP < t.length ? (c.text += t[c.skillP], c.skillP++) : c.delay ? c.delay-- : (c.direction = "backward", c.delay = a) : c.skillP > 0 ? (c.text = c.text.slice(0, -1), c.skillP--) : (c.skillI = (c.skillI + 1) % o.length, c.direction = "forward")), r.textContent = c.text, r.appendChild(n(c.prefixP < l.length ? Math.min(s, s + c.prefixP) : Math.min(s, t.length - c.skillP))), setTimeout(i, d)
        }
        var l = "",
                o = ["碰到一点压力", "就把自己变成不堪重负的样子","碰到一点不确定性", "就把前途描慕成暗淡无光","你TM若爆了 ！","干就完了","两宫遥相望，双阙百余尺。","极宴娱心意，戚戚何所迫？"].map(function (r) {
                    return r + ""
                }),
                a = 2,
                g = 1,
                s = 5,
                d = 75,
                b = ["rgb(110,64,170)", "rgb(150,61,179)", "rgb(191,60,175)", "rgb(228,65,157)", "rgb(254,75,131)", "rgb(255,94,99)", "rgb(255,120,71)", "rgb(251,150,51)", "rgb(226,183,47)", "rgb(198,214,60)", "rgb(175,240,91)", "rgb(127,246,88)", "rgb(82,246,103)", "rgb(48,239,130)", "rgb(29,223,163)", "rgb(26,199,194)", "rgb(35,171,216)", "rgb(54,140,225)", "rgb(76,110,219)", "rgb(96,84,200)"],
                c = {
                    text: "",
                    prefixP: -s,
                    skillI: 0,
                    skillP: 0,
                    direction: "forward",
                    delay: a,
                    step: g
                };
        i()
    };
    binft(document.getElementById('binft'));
</script>


<!-- 不蒜子统计 -->
<span id="busuanzi_container_site_pv">
                本站总访问量<span id="busuanzi_value_site_pv"></span>次
        </span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv" style='display:none'>
                本站访客数<span id="busuanzi_value_site_uv"></span>人
        </span>




    <div class="openNav no-select" style="height: 50px;">
      <div class="iconflat no-select" style="width: 50px; height: 50px;">
        <div class="icon"></div>
      </div>
      <div class="site-branding search-form-submit">
        <i class="iconfont js-toggle-search iconsearch icon-search"></i>
      </div>
    </div>
  </section>


  <!---->
  <!-- ���������������ɫ���� --><script src="https://cdn.jsdelivr.net/gh/wallleap/cdn/js/shehuizhuyi.js"></script>
  <!-- ������ְ��� --><script src="https://cdn.jsdelivr.net/gh/wallleap/cdn/js/love.js"></script>

  <script type="text/javascript">
    var windowWidth = $(window).width(); if (windowWidth > 768) { document.write('<script type="text/javascript" src="/js/sakura.js"><\/script>'); }
  </script>


  <div id="mo-nav" class="">
  <div class="m-avatar">
    <img src="https://cdn.jsdelivr.net/gh/geng-chao/PicGo/img/21.jpg">
  </div>
  <p style="text-align: center; color: #333; font-weight: 900; font-family: 'Ubuntu', sans-serif; letter-spacing: 1.5px">BigBoss耿超</p>
  <p style="text-align: center; word-spacing: 20px;">
    
      
        <a href="http://github.com/geng-chao" class="fa fa-github" target="_blank" style="color: #333; margin-left:20px"></a>
      
        <a href="http://weibo.com/mashirozx?is_all=1" class="fa fa-weibo" target="_blank" style="color: #dd4b39; margin-left:20px"></a>
      
        <a href="https://wpa.qq.com/msgrd?v=3&uin=2420479774&site=qq&menu=yes" class="fa fa-qq" target="_blank" style="color: #25c6fe; margin-left:20px"></a>
      
    
  </p>
  <ul id="menu-new-1" class="menu">
    
      <li>
        <a href="/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-fort-awesome faa-shake" aria-hidden="true"></i>
            首页
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/archives">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-archive faa-shake" aria-hidden="true"></i>
            归档
          </span>
        </a>
        
          <ul class="sub-menu">
            
              <li>
                <a href="/categories/技术/">
                  <i class="fa fa-code" aria-hidden="true"></i>
                  技术
                </a>
              </li>
            
              <li>
                <a href="/categories/生活/">
                  <i class="fa fa-file-text-o" aria-hidden="true"></i>
                  生活
                </a>
              </li>
            
              <li>
                <a href="/categories/资源/">
                  <i class="fa fa-cloud-download" aria-hidden="true"></i>
                  资源
                </a>
              </li>
            
              <li>
                <a href="/categories/java/">
                  <i class="fa fa-commenting-o" aria-hidden="true"></i>
                  java
                </a>
              </li>
            
              <li>
                <a href="/categories/转载/">
                  <i class="fa fa-book" aria-hidden="true"></i>
                  转载
                </a>
              </li>
            
          </ul>
        
      </li>
    
      <li>
        <a href="javascript:;">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-list-ul faa-vertical" aria-hidden="true"></i>
            清单
          </span>
        </a>
        
          <ul class="sub-menu">
            
              <li>
                <a href="/tags/悦读/">
                  <i class="fa fa-th-list faa-bounce" aria-hidden="true"></i>
                  书单
                </a>
              </li>
            
              <li>
                <a href="/bangumi/">
                  <i class="fa fa-film faa-vertical" aria-hidden="true"></i>
                  番组
                </a>
              </li>
            
              <li>
                <a href="/music/">
                  <i class="fa fa-headphones" aria-hidden="true"></i>
                  歌单
                </a>
              </li>
            
              <li>
                <a href="/tags/图集/">
                  <i class="fa fa-photo" aria-hidden="true"></i>
                  图集
                </a>
              </li>
            
          </ul>
        
      </li>
    
      <li>
        <a href="/comment/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-pencil-square-o faa-tada" aria-hidden="true"></i>
            留言板
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/links/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-link faa-shake" aria-hidden="true"></i>
            友人帐
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/donate/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-heart faa-pulse" aria-hidden="true"></i>
            赞赏
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-leaf faa-wrench" aria-hidden="true"></i>
            关于
          </span>
        </a>
        
          <ul class="sub-menu">
            
              <li>
                <a href="/about/">
                  <i class="fa fa-meetup" aria-hidden="true"></i>
                  我？
                </a>
              </li>
            
              <li>
                <a href="/theme-sakura/">
                  <i class="fa iconfont icon-sakura" aria-hidden="true"></i>
                  主题
                </a>
              </li>
            
              <li>
                <a href="/lab/">
                  <i class="fa fa-cogs" aria-hidden="true"></i>
                  Lab
                </a>
              </li>
            
          </ul>
        
      </li>
    
      <li>
        <a href="/client/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-android faa-vertical" aria-hidden="true"></i>
            客户端
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/atom.xml">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-rss faa-pulse" aria-hidden="true"></i>
            RSS
          </span>
        </a>
        
      </li>
    
  </ul>
  <p style="text-align: center; font-size: 13px; color: #b9b9b9;">&copy 2019 hexo-sakura</p>
</div>
<button onclick="topFunction()" class="mobile-cd-top" id="moblieGoTop" title="Go to top" style="display: none;"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!-- require MetingJS -->
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>
<style>
  .aplayer .aplayer-lrc {
    height: 35px;
  }
  .aplayer .aplayer-lrc p{
    font-size: 16px;
    font-weight: 700;
    line-height: 18px !important;
  }
  .aplayer .aplayer-lrc p.aplayer-lrc-current{
    color: #FF1493;
  }
  .aplayer.aplayer-narrow .aplayer-body{
    left: -66px !important;
  }
  .aplayer.aplayer-fixed .aplayer-lrc {
    display: none;
  }
  .aplayer .aplayer-lrc.aplayer-lrc-hide {
      display:none !important;
  }
  .aplayer.aplayer-fixed .lrc-show {
    display: block;
    background: rgba(255, 255, 255, 0.8);
  }
</style>
<meting-js

    id="2660651585"

    server="netease"

    type="playlist"

    fixed="true"

    autoplay="true"

    loop="all"

    order="random"

    preload="auto"

    volume="0.7"

    mutex="true"

</meting-js>
<script>
  $(function(){
    $('body').on('click', '.aplayer', function(){
      if($('.aplayer-button').hasClass('aplayer-play')) {
        $('.aplayer-lrc').removeClass('lrc-show');
      } else {
        $('.aplayer-lrc').addClass('lrc-show');
      }
    })
  });
</script>
</body>
</html>